package com.charonmc.commands;

import com.charonmc.CharonHub;
import com.charonmc.parkour.ParkourManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class End implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){
        if (sender instanceof Player){
            Player player = (Player) sender;
            if (ParkourManager.parkourPlayers.containsKey(player)){
                ParkourManager.removePlayer(player);
                player.sendMessage("§c§l已退出跑酷");
                CharonHub.setPlayerDefaultInventory(player);
            } else {
                return true;
            }
        }
        return true;
    }
}
